import React from 'react';
import {ButtonComp, PageItem, GlobalProvider} from 'jh-lib';
import {omit} from 'lodash-es'

class Test1 extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        return (
            <GlobalProvider>
                <div style={{height: 600, position: 'relative', border: '1px solid #eee'}}>
                    <PageItem
                        loading={false}
                        className={'page-item'}
                        // title={this.props.title}
                        // visible={this.props.visible}
                        // onCancel={this.props.onCancel}
                        {...omit(this.props, ['children'])}
                    >
                        {this.props.children}
                    </PageItem>
                </div>
            </GlobalProvider>
        )
    }
}

export default class Test extends React.Component {
    state = {
        visible: false
    };
    cancel = () => {
        this.setState({detailLoading: false})
    };

    render() {
        return (
            <>
                <ButtonComp onClick={() => {
                    this.setState({
                        visible: true,
                    })
                }}>
                    查看详情
                </ButtonComp>
                {
                    this.state.visible ? <>
                        <Test1
                            visible={this.state.visible}
                            title='新建 测试PageItem'
                            onCancel={() => {
                                this.setState({
                                    visible: false,
                                })
                            }}
                        >
                            按业务需求去布局...
                        </Test1>
                    </> : ''
                }
            </>
        )
    }
}
